package com.ai5suoai.ams.service;

import com.ai5suoai.ams.entity.Authority;
import com.ai5suoai.ams.repository.AuthorityRepository;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Service;

/**
 * @author chenzhenjia
 * @since 16/4/21
 */
@Service
public class AuthorityService extends MongoService<Authority, Authority, String> {

    @Autowired
    AuthorityRepository authorityRepository;

    @Override
    MongoRepository<Authority, String> getRepository() {
        return authorityRepository;
    }

    /**
     * 根据名字查询
     *
     * @param name 名字
     */
    public Authority findByName(String name) {
        return authorityRepository.findByName(name);
    }

    /**
     * 根据多个名字查询多条
     *
     * @param name 名字
     */
    public Iterable<Authority> findByName(String... name) {
        return authorityRepository.findByName(name);
    }
}
